<template>
  <div>
    <div class="detail-wrap">
      <div class="btn-group clearfix">
        <el-button type="primary" class="primary_btn fr" @click.stop="enlarge">{{$t('channelsettings.process5')}}</el-button>
      </div>

      <label class="label-text">{{$t('channelsettings.process2')}}</label>
        <el-input size="mini"  v-model.trim="currentData.DisplayName" auto-complete="off" :disabled="true"></el-input>
      <label class="label-text">{{$t('channelsettings.process6')}}</label>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-select size="mini" v-model="currentData.FirstNodeType" :placeholder="$t('public.pleasePick')" :disabled="true" class="select">
            <el-option
                    v-for="item in toPeerTypeArr"
                    :key="item.TypeValue"
                    :label="item.TypeName"
                    :value="item.TypeValue"
                    >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12">
          <el-select v-show="showSelect === 'agent'" size="mini" v-model="currentData.FirstNode" :placeholder="$t('public.pleasePick')" :disabled="true" class="select">
            <el-option
                    v-for="item in FirstNodeArr"
                    :key="item._id"
                    :label="item.displayName"
                    :value="item._id"
                    >
            </el-option>
          </el-select>
          <el-select v-show="showSelect === 'system' || showSelect === 'others'" size="mini" v-model="currentData.FirstNode" :placeholder="$t('public.pleasePick')" :disabled="true" class="select">
            <el-option
                    v-for="item in FirstNodeArr"
                    :key="item.Exten"
                    :label="item.DisplayName"
                    :value="item.Exten"
                    >
            </el-option>
          </el-select>
        </el-col>
      </el-row>
      <div v-show="chartError" class="error font16">
        {{$t('channelsettings.process7')}}
      </div>
      <div class="svgContainer" v-show="!chartError">
        <div id="mermaidholder">
        </div>
      </div>
      <div class="icon-group">
        <i class="fa fa-volume-up" aria-hidden="true"></i>：{{$t('channelsettings.process8')}}&nbsp;&nbsp;
        <i class="fa fa-file-audio-o" aria-hidden="true"></i>：{{$t('channelsettings.process9')}}&nbsp;&nbsp;
        <i class="fa fa-building-o" aria-hidden="true"></i>：{{$t('channelsettings.process10')}}&nbsp;&nbsp;
        <i class="fa fa-files-o" aria-hidden="true"></i>：{{$t('channelsettings.process11')}}&nbsp;&nbsp;<br/>
        <i class="fa fa-volume-control-phone" aria-hidden="true"></i>：{{$t('channelsettings.process12')}}&nbsp;&nbsp;
        <i class="fa fa-clock-o" aria-hidden="true"></i>：{{$t('channelsettings.process13')}}&nbsp;&nbsp;
        <i class="fa fa-envelope-o" aria-hidden="true"></i>：{{$t('channelsettings.process14')}}&nbsp;&nbsp;
        <i class="fa fa-home" aria-hidden="true"></i>：{{$t('channelsettings.process15')}}&nbsp;&nbsp;
        <i class="fa fa-heartbeat" aria-hidden="true"></i>：{{$t('channelsettings.process16')}}&nbsp;&nbsp;<br/>
        <i class="fa fa-retweet" aria-hidden="true"></i>：{{$t('channelsettings.process17')}}&nbsp;&nbsp;
        <i class="fa fa-shield" aria-hidden="true"></i>：{{$t('channelsettings.process18')}}&nbsp;&nbsp;
        <i class="fa fa-random" aria-hidden="true"></i>：{{$t('channelsettings.process19')}}&nbsp;&nbsp;<br/>
        <i class="fa fa-tags" aria-hidden="true"></i>：{{$t('channelsettings.process20')}}&nbsp;&nbsp;
        <i class="fa fa-phone" aria-hidden="true"></i>：{{$t('channelsettings.process21')}}&nbsp;&nbsp;
        <i class="fa fa-deaf" aria-hidden="true"></i>：{{$t('channelsettings.process22')}}&nbsp;&nbsp;<br/>
        <i class="fa fa-lock" aria-hidden="true"></i>：{{$t('channelsettings.process23')}}&nbsp;&nbsp;
        <i class="fa fa-heart" aria-hidden="true"></i>：{{$t('channelsettings.process24')}}&nbsp;&nbsp;
        <i class="fa fa-phone" aria-hidden="true"></i>：{{$t('channelsettings.process25')}}&nbsp;&nbsp;<br/>
        <i class="fa fa-exchange" aria-hidden="true"></i>：{{$t('channelsettings.process26')}}&nbsp;&nbsp;
        <i class="fa fa-microphone" aria-hidden="true"></i>：{{$t('channelsettings.process27')}}&nbsp;&nbsp;
        <i class="fa fa-users" aria-hidden="true"></i>：{{$t('channelsettings.process28')}}&nbsp;&nbsp;
        <i class="fa fa-user" aria-hidden="true"></i>：{{$t('channelsettings.process29')}}&nbsp;&nbsp;
      </div>
    </div>
  </div>
</template>
<script>
  import mermaid from 'mermaid'
//  import 'mermaid/dist/mermaid.forest.css'
  import 'font-awesome/css/font-awesome.css'
  export default {
    name: 'ProcessDetail',
    data () {
      let self = this
      window.nodeClick = function (item) {
        self.handlerNodeClick(item)
      }
      return {
        chartError: false,
        textCode: '',
        textLength: 0,
        FirstNodeArr: [],
        showSelect: 'others',
        toPeerTypeArr: [
          {TypeValue: 'system', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup53')},
          {TypeValue: 'ivr_node_queue', TypeName: this.$t('public.queues')},
          {TypeValue: 'account_user', TypeName: this.$t('public.agent')},
          {TypeValue: 'ivr_node_announcement', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup54')},
          {TypeValue: 'ivr_node_text_announcement', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup55')},
          {TypeValue: 'ivr_node_ivr', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup56')},
          {TypeValue: 'ivr_node_encrypt_md5', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup57')},
          {TypeValue: 'ivr_node_validation', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup58')},
          {TypeValue: 'ivr_node_assignment', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup59')},
          {TypeValue: 'ivr_node_route', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup60')},
          {TypeValue: 'ivr_node_ivr_menu', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup61')},
          {TypeValue: 'ivr_node_call_url', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup62')},
          {TypeValue: 'ivr_node_date', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup63')},
          {TypeValue: 'ivr_node_twowaycall', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup64')},
          {TypeValue: 'ivr_node_asr', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup65')},
          {TypeValue: 'ivr_node_voice_mail', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup66')},
          {TypeValue: 'ivr_node_room', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup67')},
          {TypeValue: 'ivr_node_satisfaction', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup68')},
          {TypeValue: 'ivr_node_superDialJobNum', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup69')},
          {TypeValue: 'ivr_node_extension_peer', TypeName: this.$t('callServiceSkillGroup.callServiceSkillGroup70')}
        ],
        nodeName2Alias: {
          ivr_node_announcement: 'A',
          ivr_node_text_announcement: 'B',
          ivr_node_ivr: 'C',
          ivr_node_validation: 'D',
          ivr_node_assignment: 'E',
          ivr_node_encrypt_md5: 'F',
          ivr_node_route: 'G',
          ivr_node_call_url: 'H',
          ivr_node_voice_mail: 'I',
          ivr_node_room: 'J',
          ivr_node_satisfaction: 'K',
          ivr_node_extension_peer: 'L',
          ivr_node_superDialJobNum: 'M',
          ivr_node_ivr_menu: 'N',
          system: {
            0: 'O1', // 挂机
            1: 'O2', // 满意度调查
            2: 'O3'  // 拨打工号
          },
          ivr_node_system: 'O3',
          ivr_node_queue: 'P',
          account_user: 'Q',
          ivr_node_twowaycall: 'R',
          ivr_node_asr: 'S',
          ivr_node_date: 'T'
        },
        nodeType2Font: {
          ivr_node_announcement: 'fa:fa-volume-up',
          ivr_node_text_announcement: 'fa:fa-file-audio-o',
          ivr_node_ivr: 'fa:fa-building-o',
          ivr_node_validation: 'fa:fa-retweet',
          ivr_node_assignment: 'fa:fa-files-o',
          ivr_node_encrypt_md5: 'fa:fa-shield',
          ivr_node_route: 'fa:fa-random',
          ivr_node_call_url: 'fa:fa-volume-control-phone',
          ivr_node_voice_mail: 'fa:fa-envelope-o',
          ivr_node_room: 'fa:fa-home',
          ivr_node_satisfaction: 'fa:fa-heartbeat',
          ivr_node_extension_peer: 'fa:fa-tags',
          ivr_node_superDialJobNum: 'fa:fa-phone',
          ivr_node_ivr_menu: 'fa:fa-deaf',
          ivr_node_system: 'fa:fa-phone',
          ivr_node_queue: 'fa:fa-users',
          account_user: 'fa:fa-user',
          system: {
            0: 'fa:fa-lock', // 挂机
            1: 'fa:fa-heart', // 满意度调查
            2: 'fa:fa-phone'  // 拨打工号
          },
          ivr_node_twowaycall: 'fa:fa-exchange',
          ivr_node_asr: 'fa:fa-microphone',
          ivr_node_date: 'fa:fa-clock-o'
        },
        nodeName2ChineseName: {
          ivr_node_announcement: this.$t('callServiceSkillGroup.callServiceSkillGroup54'),
          ivr_node_text_announcement: this.$t('callServiceSkillGroup.callServiceSkillGroup55'),
          ivr_node_ivr: this.$t('callServiceSkillGroup.callServiceSkillGroup56'),
          ivr_node_validation: this.$t('callServiceSkillGroup.callServiceSkillGroup58'),
          ivr_node_assignment: this.$t('callServiceSkillGroup.callServiceSkillGroup59'),
          ivr_node_encrypt_md5: this.$t('callServiceSkillGroup.callServiceSkillGroup57'),
          ivr_node_route: this.$t('callServiceSkillGroup.callServiceSkillGroup60'),
          ivr_node_call_url: this.$t('callServiceSkillGroup.callServiceSkillGroup62'),
          ivr_node_voice_mail: this.$t('callServiceSkillGroup.callServiceSkillGroup66'),
          ivr_node_room: this.$t('callServiceSkillGroup.callServiceSkillGroup67'),
          ivr_node_satisfaction: this.$t('callServiceSkillGroup.callServiceSkillGroup68'),
          ivr_node_extension_peer: this.$t('callServiceSkillGroup.callServiceSkillGroup70'),
          ivr_node_superDialJobNum: this.$t('callServiceSkillGroup.callServiceSkillGroup69'),
          ivr_node_ivr_menu: this.$t('callServiceSkillGroup.callServiceSkillGroup61'),
          system: {
            0: this.$t('softPhoneBar.hangup'), // 挂机
            1: this.$t('cti.satiSearch'), // 满意度调查
            2: this.$t('call.dialNumber')  // 拨打工号
          },
          ivr_node_system: this.$t('call.dialNumber'),
          ivr_node_queue: this.$t('public.queues'),
          account_user: this.$t('public.agent'),
          ivr_node_twowaycall: this.$t('callServiceSkillGroup.callServiceSkillGroup64'),
          ivr_node_asr: this.$t('callServiceSkillGroup.callServiceSkillGroup65'),
          ivr_node_date: this.$t('callServiceSkillGroup.callServiceSkillGroup63')
        },
        node2PeerCondition: {
          ivr_node_announcement: 'next',
          ivr_node_text_announcement: 'next',
          ivr_node_validation: {
            ToPeerType: this.$t('questionnaire.successStatus'),
            ToPeerTypeWhenWaitTimeout: this.$t('monitor.outTime')
          },
          ivr_node_assignment: 'next',
          ivr_node_encrypt_md5: 'next',
          ivr_node_route: {
            ToPeerType: this.$t('channel.condition'),
            ToPeerTypeUnmatched: this.$t('channelsettings.process40')
          },
          ivr_node_call_url: {
            NextPeerType: this.$t('questionnaire.successStatus'),
            ToPeerTypeWhenTimeout: this.$t('monitor.outTime')
          },
          ivr_node_voice_mail: 'next',
          ivr_node_satisfaction: 'next',
          ivr_node_superDialJobNum: {
            ToPeerTypeWhenFrontOffice: this.$t('channelsettings.process31'),
            ToPeerTypeWhenEmpnoNotExist: this.$t('channelsettings.process32'),
            ToPeerTypeWhenEmpnoAgentBusy: this.$t('channelsettings.process33'),
            ToPeerTypeWhenEmpnoLogoff: this.$t('channelsettings.process34')
          },
          ivr_node_ivr_menu: 'next',
          ivr_node_system: {
            ToPeerTypeWhenEmpnoNotExist: this.$t('channelsettings.process32'),
            ToPeerTypeWhenEmpnoAgentBusy: this.$t('channelsettings.process33'),
            ToPeerTypeWhenEmpnoLogoff: this.$t('channelsettings.process35')
          },
          ivr_node_queue: {
            ToPeerTypeWhenQueueEmpty: this.$t('channelsettings.process36'),
            ToPeerTypeWhenWait: this.$t('channelsettings.process37'),
            ToPeerTypeWhenWaitTimeout: this.$t('channelsettings.process38'),
            ToPeerTypeWhenHanguped: this.$t('channelsettings.process39')
          },
          ivr_node_date: {
            NextPeerUnmatch: this.$t('channelsettings.process40'),
            NextPeer: this.$t('channelsettings.process41'),
            Order: this.$t('channelsettings.process42')
          }
        },
        systemPeerTypeArr: [
          {name: this.$t('softPhoneBar.hangup'), value: '0'},
          {name: this.$t('cti.satiSearch'), value: '1'},
          {name: this.$t('callServiceSkillGroup.callServiceSkillGroup71'), value: '2'}
        ],
        vars: {}
      }
    },
    props: {
      showBread: String,
      currentData: {
        type: Object,
        default: function () {
          return {}
        }
      },
      isWatch: {type: Number, default: 0}
    },
    methods: {
      handlerNodeClick (val) {
        console.log(val)
      },
      enlarge () {
        let dragObj = {textCode: this.textCode, name: this.$t('channelsettings.process30'), open: true}
        this.$store.commit('SET_BING_CALL_PROCESS', dragObj)
      },
      getFirstNode (currentPbx) {
        let ivrObj = this.$store.state.session.ivrMap[currentPbx]
        let ivrData = {}
        if (ivrObj) {
          ivrData = ivrObj.data
        }
        if (ivrData) {
          let toPeerArr = ivrData[this.currentData.FirstNodeType]
          if (!this.currentData.FirstNodeType || this.currentData.FirstNodeType === 'system') {
            this.FirstNodeArr = toPeerArr
            this.showSelect = 'system'
          } else {
            if (toPeerArr) {
              this.FirstNodeArr = toPeerArr
              if (this.currentData.FirstNodeType === 'account_user') {
                this.showSelect = 'agent'
              } else {
                this.showSelect = 'others'
              }
            }
          }
        }
      },
      processChart (currentPbx) {
        let ivrObj = this.$store.state.session.ivrMap[currentPbx]
        let ivr = {}
        if (ivrObj) {
          ivr = ivrObj.data
        } else {
          return
        }
        this.getFirstNode(currentPbx)
        for (let i in ivr.vars) {
          this.vars[ivr.vars[i].VarName] = ivr.vars[i].Memo
        }
        let nodeType = this.currentData.FirstNodeType
        let nodeExten = this.currentData.FirstNode
        if (nodeType === 'system' && nodeExten === '2') {
          nodeType = 'ivr_node_system'
        }
        let nodeArr = []
        let nodeObj = {}
        nodeObj.nodeType = nodeType
        nodeObj.nodeExten = nodeExten
        nodeArr.push(nodeObj)
        let existNodeArr = []
        this.textCode = ''
        this.textLength = 0
        this.processNode(currentPbx, nodeArr, existNodeArr, true)
        let mermaidholder = document.getElementById('mermaidholder')
        if (mermaidholder && mermaidholder.firstChild) {
          mermaidholder.removeChild(mermaidholder.firstChild)
        }
        let mermaidnode = document.createElement('div')
        mermaidnode.className = 'mermaid'
        mermaidnode.appendChild(document.createTextNode(this.textCode))
        mermaidholder.appendChild(mermaidnode)
        mermaid.init()
        let nodeArray = document.querySelectorAll('#mermaidholder g.nodes g.node')
        if (nodeArray.length <= 0) {
          this.chartError = true
        } else {
          this.chartError = false
        }
      },
      processNode (currentPbx, nodes, existNodeArr, isStartNode, preNodeCode) { // 递归生成IVR流程图文本串
        let ivrObj = this.$store.state.session.ivrMap[currentPbx]
        let ivr = {}
        if (ivrObj) {
          ivr = ivrObj.data
        }
        for (let key in nodes) {
          let nodeType = nodes[key].nodeType
          let nodeExten = nodes[key].nodeExten
          if (nodeType && nodeExten) {
            if (nodeType === 'system' && nodeExten === '2') {
              nodeType = 'ivr_node_system'
            }
            let peerCondition = ''
            if (nodes[key].peerCondition) {
              peerCondition = nodes[key].peerCondition === 'next' ? '' : '--' + nodes[key].peerCondition
            }
            let nodeAlias = ''
            let nodeName = ''
            let nodeCode = ''
            let nodeFont = ''
            let unicodeName = ''
            let currentNode = null
            let nextNodeArr = []
            if (nodeType === 'system') {
              nodeAlias = this.nodeName2Alias[nodeType][nodeExten]
              nodeFont = this.nodeType2Font[nodeType][nodeExten]
            } else {
              nodeAlias = this.nodeName2Alias[nodeType]
              nodeFont = this.nodeType2Font[nodeType]
            }
            if (isStartNode) {
              existNodeArr.push(nodeAlias + ':' + nodeExten)
              if (nodeType === 'account_user') {
                for (let i in ivr[nodeType]) {
                  if (nodeExten === ivr[nodeType][i]._id) {
                    currentNode = ivr[nodeType][i]
                    nodeExten = currentNode.exten
                    nodeName = currentNode.displayName
                    if (nodeName.length > 5) {
                      for (let x = 0; x < 5; x++) {
                        unicodeName += '&#' + nodeName.charCodeAt(x)
                      }
                      nodeName = unicodeName + '..'
                    } else {
                      for (let y = 0; y < nodeName.length; y++) {
                        unicodeName += '&#' + nodeName.charCodeAt(y)
                      }
                      nodeName = unicodeName
                    }
                    break
                  }
                }
                if (currentNode) {
                  nodeCode = nodeAlias + '-' + nodeExten
                  this.textCode += 'graph LR\n' + nodeCode + '((' + nodeFont + ' ' + nodeName + '))\n'
                  this.textLength ++
                }
              } else {
                for (let i in ivr[nodeType]) {
                  if (nodeExten === ivr[nodeType][i].Exten) {
                    currentNode = ivr[nodeType][i]
                    nodeName = currentNode.DisplayName
                    break
                  }
                }
                if (currentNode) {
                  if (nodeType === 'ivr_node_system') {
                    nodeName = this.$t('call.dialNumber')
                  }
                  if (nodeName.length > 5) {
                    for (let x = 0; x < 5; x++) {
                      unicodeName += '&#' + nodeName.charCodeAt(x)
                    }
                    nodeName = unicodeName + '..'
                  } else {
                    for (let y = 0; y < nodeName.length; y++) {
                      unicodeName += '&#' + nodeName.charCodeAt(y)
                    }
                    nodeName = unicodeName
                  }
                  nodeCode = nodeAlias + '-' + nodeExten
                  this.textCode += 'graph LR\n' + nodeCode + '((' + nodeFont + ' ' + nodeName + '))\n'
                  this.textLength ++

                  if (nodeType === 'ivr_node_system') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerTypeWhenEmpnoNotExist
                    nextNodeObj.nodeExten = currentNode.ToPeerWhenEmpnoNotExist
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoNotExist
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenEmpnoAgentBusy
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenEmpnoAgentBusy
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoAgentBusy
                    let nextNodeObj2 = {}
                    nextNodeObj2.nodeType = currentNode.ToPeerTypeWhenEmpnoLogoff
                    nextNodeObj2.nodeExten = currentNode.ToPeerWhenEmpnoLogoff
                    nextNodeObj2.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoLogoff
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    nextNodeArr.push(nextNodeObj2)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_announcement' || nodeType === 'ivr_node_text_announcement' ||
                          nodeType === 'ivr_node_assignment' || nodeType === 'ivr_node_voice_mail') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerType
                    nextNodeObj.nodeExten = currentNode.ToPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType]
                    nextNodeArr.push(nextNodeObj)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_encrypt_md5' || nodeType === 'ivr_node_satisfaction' ||
                          nodeType === 'ivr_node_ivr_menu' || nodeType === 'ivr_node_asr') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.NextPeerType
                    nextNodeObj.nodeExten = currentNode.NextPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType]
                    nextNodeArr.push(nextNodeObj)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_validation') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerType
                    nextNodeObj.nodeExten = currentNode.ToPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerType
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenWaitTimeout
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenWaitTimeout
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenWaitTimeout
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_call_url') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.NextPeerType
                    nextNodeObj.nodeExten = currentNode.NextPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].NextPeerType
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenTimeout
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenTimeout
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenTimeout
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_ivr') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    this.textCode += nodeCode + '-->' + nodeAlias + '-' + 'V' + '-' + nodeExten + '{按键}\n'
                    nodeCode = nodeAlias + '-' + 'V' + '-' + nodeExten
                    existNodeArr.push(nodeCode)
                    for (let j in currentNode.IvrKeys) {
                      let nextNodeObj = {}
                      nextNodeObj.nodeType = currentNode.IvrKeys[j].ToPeerType
                      nextNodeObj.nodeExten = currentNode.IvrKeys[j].ToPeer
                      nextNodeObj.peerCondition = currentNode.IvrKeys[j].Key
                      nextNodeArr.push(nextNodeObj)
                    }
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_route') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let validateText = this.$t('channelsettings.process43')
                    this.textCode += nodeCode + '-->' + nodeAlias + '-' + 'V' + '-' + nodeExten + '{' + validateText + '}\n'
                    nodeCode = nodeAlias + '-' + 'V' + '-' + nodeExten
                    existNodeArr.push(nodeCode)
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerType
                    nextNodeObj.nodeExten = currentNode.ToPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerType
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeUnmatched
                    nextNodeObj1.nodeExten = currentNode.ToPeerUnmatched
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeUnmatched
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_date') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let validateText = this.$t('channelsettings.process44')
                    this.textCode += nodeCode + '-->' + nodeAlias + '-' + 'V' + '-' + nodeExten + '{' + validateText + '}\n'
                    nodeCode = nodeAlias + '-' + 'V' + '-' + nodeExten
                    existNodeArr.push(nodeCode)
                    let dates = currentNode.Dates
                    if (dates != null && dates.length > 0) {
                      for (let key in dates) {
                        let date = dates[key]
                        let nextNodeObj = {}
                        nextNodeObj.nodeType = date.NextPeerType
                        nextNodeObj.nodeExten = date.NextPeer
                        let peerCondition = this.node2PeerCondition[nodeType].Order + '  ' + date.Order
                        nextNodeObj.peerCondition = peerCondition
                        nextNodeArr.push(nextNodeObj)
                      }
                    }
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.NextPeerUnmatchType
                    nextNodeObj1.nodeExten = currentNode.NextPeerUnmatch
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].NextPeerUnmatch
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_superDialJobNum') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerTypeWhenFrontOffice
                    nextNodeObj.nodeExten = currentNode.ToPeerWhenFrontOffice
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenFrontOffice
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenEmpnoNotExist
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenEmpnoNotExist
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoNotExist
                    let nextNodeObj2 = {}
                    nextNodeObj2.nodeType = currentNode.ToPeerTypeWhenEmpnoAgentBusy
                    nextNodeObj2.nodeExten = currentNode.ToPeerWhenEmpnoAgentBusy
                    nextNodeObj2.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoAgentBusy
                    let nextNodeObj3 = {}
                    nextNodeObj3.nodeType = currentNode.ToPeerTypeWhenEmpnoLogoff
                    nextNodeObj3.nodeExten = currentNode.ToPeerWhenEmpnoLogoff
                    nextNodeObj3.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoLogoff
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    nextNodeArr.push(nextNodeObj2)
                    nextNodeArr.push(nextNodeObj3)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_queue') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerTypeWhenQueueEmpty
                    nextNodeObj.nodeExten = currentNode.ToPeerWhenQueueEmpty
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenQueueEmpty
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenWait
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenWait
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenWait
                    let nextNodeObj2 = {}
                    nextNodeObj2.nodeType = currentNode.ToPeerTypeWhenWaitTimeout
                    nextNodeObj2.nodeExten = currentNode.ToPeerWhenWaitTimeout
                    nextNodeObj2.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenWaitTimeout
                    let nextNodeObj3 = {}
                    nextNodeObj3.nodeType = currentNode.ToPeerTypeWhenHanguped
                    nextNodeObj3.nodeExten = currentNode.ToPeerWhenHanguped
                    nextNodeObj3.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenHanguped
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    nextNodeArr.push(nextNodeObj2)
                    nextNodeArr.push(nextNodeObj3)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_room' || nodeType === 'ivr_node_extension_peer' || nodeType === 'ivr_node_twowaycall') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                  }
                }
              }
            } else if (existNodeArr.indexOf(nodeAlias + ':' + nodeExten) === -1) {
              existNodeArr.push(nodeAlias + ':' + nodeExten)
              if (nodeType === 'account_user') {
                for (let i in ivr[nodeType]) {
                  if (nodeExten === ivr[nodeType][i]._id) {
                    currentNode = ivr[nodeType][i]
                    nodeExten = currentNode.exten
                    nodeName = currentNode.displayName
                    if (nodeName.length > 5) {
                      for (let x = 0; x < 5; x++) {
                        unicodeName += '&#' + nodeName.charCodeAt(x)
                      }
                      nodeName = unicodeName + '..'
                    } else {
                      for (let y = 0; y < nodeName.length; y++) {
                        unicodeName += '&#' + nodeName.charCodeAt(y)
                      }
                      nodeName = unicodeName
                    }
                    break
                  }
                }
                if (currentNode) {
                  nodeCode = nodeAlias + '-' + nodeExten
                  this.textCode += preNodeCode + peerCondition + '-->' + nodeCode + '(' + nodeFont + ' ' + nodeName + ')\n'
                  this.textLength ++
                }
              } else {
                for (let i in ivr[nodeType]) {
                  if (nodeExten === ivr[nodeType][i].Exten) {
                    currentNode = ivr[nodeType][i]
                    nodeName = currentNode.DisplayName
                    break
                  }
                }
                if (currentNode) {
                  if (nodeType === 'ivr_node_system') {
                    nodeName = this.$t('call.dialNumber')
                  }
                  if (nodeName.length > 5) {
                    for (let x = 0; x < 5; x++) {
                      unicodeName += '&#' + nodeName.charCodeAt(x)
                    }
                    nodeName = unicodeName + '..'
                  } else {
                    for (let y = 0; y < nodeName.length; y++) {
                      unicodeName += '&#' + nodeName.charCodeAt(y)
                    }
                    nodeName = unicodeName
                  }
                  nodeCode = nodeAlias + '-' + nodeExten
                  if (nodeType === 'ivr_node_queue') {
                    this.textCode += preNodeCode + peerCondition + '-->' + nodeCode + '(' + nodeFont + ' ' + nodeName + ')\n'
                  } else {
                    this.textCode += preNodeCode + peerCondition + '-->' + nodeCode + '[' + nodeFont + ' ' + nodeName + ']\n'
                  }
                  this.textLength ++
                  if (nodeType === 'ivr_node_system') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerTypeWhenEmpnoNotExist
                    nextNodeObj.nodeExten = currentNode.ToPeerWhenEmpnoNotExist
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoNotExist
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenEmpnoAgentBusy
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenEmpnoAgentBusy
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoAgentBusy
                    let nextNodeObj2 = {}
                    nextNodeObj2.nodeType = currentNode.ToPeerTypeWhenEmpnoLogoff
                    nextNodeObj2.nodeExten = currentNode.ToPeerWhenEmpnoLogoff
                    nextNodeObj2.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoLogoff
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    nextNodeArr.push(nextNodeObj2)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_announcement' || nodeType === 'ivr_node_text_announcement' ||
                          nodeType === 'ivr_node_assignment' || nodeType === 'ivr_node_voice_mail') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerType
                    nextNodeObj.nodeExten = currentNode.ToPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType]
                    nextNodeArr.push(nextNodeObj)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_encrypt_md5' || nodeType === 'ivr_node_satisfaction' ||
                          nodeType === 'ivr_node_ivr_menu' || nodeType === 'ivr_node_asr') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.NextPeerType
                    nextNodeObj.nodeExten = currentNode.NextPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType]
                    nextNodeArr.push(nextNodeObj)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_validation') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerType
                    nextNodeObj.nodeExten = currentNode.ToPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerType
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenWaitTimeout
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenWaitTimeout
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenWaitTimeout
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_call_url') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.NextPeerType
                    nextNodeObj.nodeExten = currentNode.NextPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].NextPeerType
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenTimeout
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenTimeout
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenTimeout
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_ivr') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    this.textCode += nodeCode + '-->' + nodeAlias + '-' + 'V' + '-' + nodeExten + '{按键}\n'
                    nodeCode = nodeAlias + '-' + 'V' + '-' + nodeExten
                    existNodeArr.push(nodeCode)
                    for (let j in currentNode.IvrKeys) {
                      let nextNodeObj = {}
                      nextNodeObj.nodeType = currentNode.IvrKeys[j].ToPeerType
                      nextNodeObj.nodeExten = currentNode.IvrKeys[j].ToPeer
                      nextNodeObj.peerCondition = currentNode.IvrKeys[j].Key
                      nextNodeArr.push(nextNodeObj)
                    }
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_route') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let validateText = this.$t('channelsettings.process43')
                    this.textCode += nodeCode + '-->' + nodeAlias + '-' + 'V' + '-' + nodeExten + '{' + validateText + '}\n'
                    nodeCode = nodeAlias + '-' + 'V' + '-' + nodeExten
                    existNodeArr.push(nodeCode)
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerType
                    nextNodeObj.nodeExten = currentNode.ToPeer
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerType
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeUnmatched
                    nextNodeObj1.nodeExten = currentNode.ToPeerUnmatched
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeUnmatched
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_date') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    existNodeArr.push(nodeCode)
                    let validateText = this.$t('channelsettings.process44')
                    this.textCode += nodeCode + '-->' + nodeAlias + '-' + 'V' + '-' + nodeExten + '{' + validateText + '}\n'
                    nodeCode = nodeAlias + '-' + 'V' + '-' + nodeExten
                    existNodeArr.push(nodeCode)
                    let dates = currentNode.Dates
                    if (dates != null && dates.length > 0) {
                      for (let key in dates) {
                        let date = dates[key]
                        let nextNodeObj = {}
                        nextNodeObj.nodeType = date.NextPeerType
                        nextNodeObj.nodeExten = date.NextPeer
                        let peerCondition = this.node2PeerCondition[nodeType].Order + '  ' + date.Order
                        nextNodeObj.peerCondition = peerCondition
                        nextNodeArr.push(nextNodeObj)
                      }
                    }
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.NextPeerUnmatchType
                    nextNodeObj1.nodeExten = currentNode.NextPeerUnmatch
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].NextPeerUnmatch
                    nextNodeArr.push(nextNodeObj1)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_superDialJobNum') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerTypeWhenFrontOffice
                    nextNodeObj.nodeExten = currentNode.ToPeerWhenFrontOffice
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenFrontOffice
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenEmpnoNotExist
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenEmpnoNotExist
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoNotExist
                    let nextNodeObj2 = {}
                    nextNodeObj2.nodeType = currentNode.ToPeerTypeWhenEmpnoAgentBusy
                    nextNodeObj2.nodeExten = currentNode.ToPeerWhenEmpnoAgentBusy
                    nextNodeObj2.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoAgentBusy
                    let nextNodeObj3 = {}
                    nextNodeObj3.nodeType = currentNode.ToPeerTypeWhenEmpnoLogoff
                    nextNodeObj3.nodeExten = currentNode.ToPeerWhenEmpnoLogoff
                    nextNodeObj3.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenEmpnoLogoff
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    nextNodeArr.push(nextNodeObj2)
                    nextNodeArr.push(nextNodeObj3)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_queue') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                    let nextNodeObj = {}
                    nextNodeObj.nodeType = currentNode.ToPeerTypeWhenQueueEmpty
                    nextNodeObj.nodeExten = currentNode.ToPeerWhenQueueEmpty
                    nextNodeObj.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenQueueEmpty
                    let nextNodeObj1 = {}
                    nextNodeObj1.nodeType = currentNode.ToPeerTypeWhenWait
                    nextNodeObj1.nodeExten = currentNode.ToPeerWhenWait
                    nextNodeObj1.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenWait
                    let nextNodeObj2 = {}
                    nextNodeObj2.nodeType = currentNode.ToPeerTypeWhenWaitTimeout
                    nextNodeObj2.nodeExten = currentNode.ToPeerWhenWaitTimeout
                    nextNodeObj2.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenWaitTimeout
                    let nextNodeObj3 = {}
                    nextNodeObj3.nodeType = currentNode.ToPeerTypeWhenHanguped
                    nextNodeObj3.nodeExten = currentNode.ToPeerWhenHanguped
                    nextNodeObj3.peerCondition = this.node2PeerCondition[nodeType].ToPeerTypeWhenHanguped
                    nextNodeArr.push(nextNodeObj)
                    nextNodeArr.push(nextNodeObj1)
                    nextNodeArr.push(nextNodeObj2)
                    nextNodeArr.push(nextNodeObj3)
                    this.processNode(currentPbx, nextNodeArr, existNodeArr, false, nodeCode)
                  } else if (nodeType === 'ivr_node_room' || nodeType === 'ivr_node_extension_peer' || nodeType === 'ivr_node_twowaycall') {
                    this.textCode += 'click ' + nodeCode + ' nodeClick ' +
                            '"' + this.nodeName2ChineseName[nodeType] + '"\n'
                  }
                }
              }
            } else {
              if (nodeType === 'account_user') {
                for (let i in ivr[nodeType]) {
                  if (nodeExten === ivr[nodeType][i]._id) {
                    currentNode = ivr[nodeType][i]
                    nodeExten = currentNode.exten
                    break
                  }
                }
                if (currentNode) {
                  nodeCode = nodeAlias + '-' + nodeExten
                  this.textCode += preNodeCode + peerCondition + '-->' + nodeCode + '\n'
                  this.textLength ++
                }
              } else {
                for (let i in ivr[nodeType]) {
                  if (nodeExten === ivr[nodeType][i].Exten) {
                    currentNode = ivr[nodeType][i]
                    break
                  }
                }
                if (currentNode) {
                  nodeCode = nodeAlias + '-' + nodeExten
                  this.textCode += preNodeCode + peerCondition + '-->' + nodeCode + '\n'
                  this.textLength ++
                }
              }
            }
          }
        }
      }
    },
    watch: {
      isWatch (current) { // 只有点击了查询流程，才会执行画图操作。
        if (current) {
          this.processChart(this.currentData.PBX)
        }
      }
    }
  }
</script>
<style lang="stylus" scoped>
  @import "../../../../../assets/common.styl"
  .detail-wrap
     padding 20px
     .select
       width 100%
     .warn-text
       padding-bottom 20px
       color $c-prompt
     .btn-group
       margin 0 0 20px 0
     .label-text
      display inline-block
      margin 10px 0 2px 0
     .icon-group
       background #fcf8e3
       color #C09852
       border 1px solid #fbeed5
       border-radius 2px
       padding 20px
       line-height 2
     #mermaidholder
       min-height 30px
     .error
       font-size 12px
       height 60px
       line-height 60px
</style>
